package com.example.bazinga.babyhealth.presenter;

import com.example.bazinga.babyhealth.base.BasePresenter;
import com.example.bazinga.babyhealth.modle.IOutDataModel;
import com.example.bazinga.babyhealth.modle.OutDataModel;
import com.example.bazinga.babyhealth.view.IOutDataView;
import com.github.mikephil.charting.data.BarEntry;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by bazinga on 2017/5/4.
 */

public class OutDataPresenter extends BasePresenter<IOutDataView> {

    private IOutDataView iOutDataView;

    private OutDataModel outDataModel = new OutDataModel();

    public void attach(IOutDataView iOutDataView){
        this.iOutDataView = iOutDataView;
    }

    public void getExcelData(){
        if(outDataModel != null){
            outDataModel.loadExcelProgress(new IOutDataModel.GetExcelDataLoadListener() {
                @Override
                public void onCompleted(ArrayList<ArrayList<String>> datas) {
                    iOutDataView.getExcelResult(datas);
                }
            });
        }
    }

    public void getOutdata(){
        if(outDataModel != null){
            outDataModel.loadTemoDataProgress(new IOutDataModel.GetTemDataLoadListener() {
                @Override
                public void onCompleted(List<BarEntry> entries) {
                    iOutDataView.getOutDataReslut(entries);
                }
            });
        }
    }

}
